//
//  AXMyFbVC.m
//  AnXin100
//
//  Created by 天质弘耕 on 2018/10/17.
//  Copyright © 2018年 tzhg. All rights reserved.
//

#import "AXMyFbVC.h"
#import "UIView+SDAutoLayout.h"
#import "ZXCategories.h"
#import "Header.h"
#import "UITableView+SDAutoTableViewCellHeight.h"
#import "AXMyFbCollectionViewCell.h"




@interface AXMyFbVC ()<UICollectionViewDelegateFlowLayout, UICollectionViewDataSource>


@property (nonatomic ,strong) UICollectionView *collectionView;



@end

@implementation AXMyFbVC

- (void)viewDidLoad {
    //[self initData];
    [super viewDidLoad];
    [self creatView];
    self.view.backgroundColor = [UIColor whiteColor];
    [self setupNavigationItems];
    
    
}

- (void)setupNavigationItems {
    
    /** 导航条左边的按钮 */
    //返回按钮
    UIButton *kfBtn = [UIButton buttonWithType:UIButtonTypeCustom];
    [kfBtn setImage:[UIImage imageNamed:@"back"] forState:UIControlStateNormal];
    kfBtn.frame = CGRectMake(0, 0, 30, 30);
    [kfBtn addTarget:self action:@selector(backAction:) forControlEvents:UIControlEventTouchUpInside];
    UIBarButtonItem *leftItem = [[UIBarButtonItem alloc]initWithCustomView:kfBtn];
    self.navigationItem.leftBarButtonItem = leftItem;
    
    
    
    
}

#pragma mark - Action

- (void)backAction:(UIBarButtonItem *)item {
    [self.navigationController popViewControllerAnimated:YES];
}

- (void)search:(UIButton *)btn {
    
}


- (void)creatView {
    
    
    /** collectionView */
    
    UICollectionViewFlowLayout *flowLayout = [[UICollectionViewFlowLayout alloc]init];
    flowLayout.itemSize = CGSizeMake((SCREEN_WIDTH-30)/2.0, (SCREEN_WIDTH-30)/2.0);
    /** 最小行间距 */
    flowLayout.minimumLineSpacing = 10;
    /** 最小列间距 */
    flowLayout.minimumInteritemSpacing = 0;
    self.collectionView = [[UICollectionView alloc]initWithFrame:CGRectMake(0, NAVIGATION_HEIGHT, SCREEN_WIDTH, TableViewHeight) collectionViewLayout:flowLayout];
    //wangherun666
    self.collectionView.contentInset = UIEdgeInsetsMake(8, 8, 8, 8);
    self.collectionView.backgroundColor = [UIColor whiteColor];
    [self.collectionView registerClass:[AXMyFbCollectionViewCell class] forCellWithReuseIdentifier:[AXMyFbCollectionViewCell reuseID]];
    self.collectionView.delegate = self;
    self.collectionView.dataSource = self;
    [self.view addSubview:self.collectionView];
}



#pragma mark - Collection View Data Source
/** 定义展示的section的个数 */

- (NSInteger)numberOfSectionsInCollectionView:(UICollectionView *)collectionView {
    
    return 1;
}
/** 定义展示的collectionCell的个数 */
- (NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section {
    
    
    return 8;
}


- (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath {
    
    AXMyFbCollectionViewCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:[AXMyFbCollectionViewCell reuseID] forIndexPath:indexPath];
    
    
    
    return cell;
}

#pragma mark - collectionViewDelegateFlowLayout

/** UICollectionView被选中时的方法 */




#pragma mark - Setter & Getter

//- (NSMutableArray<ZXResourceModel *> *)modelsArray {
//    if (!_modelsArray) {
//        _modelsArray = [NSMutableArray<ZXResourceModel *> array];
//    }
//    return _modelsArray;
//}


@end

